<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>vue基础</title>
</head>

<body>

    <div id="app">
        <input type="button" value="v-on指令" v-on:click="do1">
        <input type="button" value="v-on指令简写·" @click="do1">
        <input type="button" value="双击事件" @dblclick="do1">
        <p @click="changeFood">{{food}}</p>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
    <script>
        var app = new Vue({
            el: "#app",
            data: {
                food: "巧克力"
            },
            methods: {
                do1: function () {
                    alert("IT")
                },
                changeFood() {
                    // console.log(this.food);
                    this.food += "很好吃"
                }
            }
        })
    </script>
</body>

</html>